<!DOCTYPE html>
<html>
<head lang="zh">
    <script>
        var evMap = {
            'dev-wcg.myscrm.cn:1001': 'dev-qmyx-cg.myscrm.cn:1002',
            'func-manage.myscrm.com.cn': 'test-qmyxcg.myscrm.com.cn',
            'beta-wcg.myscrm.cn': 'beta-qmyx-cg.myscrm.cn',
            'demo-manage.myscrm.com.cn': 'demo-qmyxcg.myscrm.com.cn',
            'www.myscrm.com.cn': 'qmyxcg.myscrm.com.cn',
            'daili-manage.myscrm.cn': 'beta-daili-qmyx-cg.myscrm.cn',
            'daili.myscrm.com.cn': 'qmyxcg-daili.myscrm.com.cn'
        };
        var hostQmyx = evMap[location.host] || 'qmyxcg.myscrm.com.cn';

        if (!evMap[location.host]) {
            alert('该页面只能在.net站点查看');
        }
    </script>
    <!--登录检查-->
    <script type="text/javascript">
        (function () {
            //没有console的浏览器,添加空方法
            var noop = function () {
            };
            var custom_console = {
                info: noop,
                warn: noop,
                error: noop
            };
            if (typeof console === "undefined") {
                window.console = custom_console;
            }

            // 获取用户信息url
            var callbackName = 'loginCallback';

            var goToLoginPage = function (url) {
                url = url || location.href;
                location.href = 'http://' + hostQmyx + "/login.shtml?ret_url=" + encodeURIComponent(url);
            };

            window[callbackName] = function (json) {
                var userData = window['YKLoginData'] = json;
                if (userData) {
                    var retCode = userData['retCode'];
                    if (retCode == 0) {
                        var data = userData['data'];

                        if (data['isGuest'] !== false) {
                            goToLoginPage();
                        }
                    } else if (retCode == '-1168202') {
                        location.href = 'http://' + hostQmyx;
                    } else {
                        goToLoginPage();
                    }
                }
            };

            function getUserInfoUrl() {
                function getUrlPara(name) {
                    var search = location.search;
                    if (search && search.indexOf("?") == 0) {
                        search = search.substring(1);
                    }

                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                    var r = search.match(reg);
                    if (r != null) {
                        return decodeURIComponent(r[2]);
                    }
                }

                var url = 'http://' + hostQmyx + '/api/index.php?r=site/login-data&callback=' + callbackName + '&t=' + new Date().getTime();

                var token = getUrlPara('token');
                if (token) {
                    url += '&token=' + token;
                }
                return url;
            }

            document.open();
            document.write('<script type="text/javascript" src="' + getUserInfoUrl() + '"><\/script>');
            document.close();
        })();
    </script>

    <title>移动销售</title>

    <link rel="stylesheet" type="text/css" href="http://www.myscrm.com.cn/_frontend/3rd/miniui/miniui.css?ver=635756009680000000"/>
    <link rel="stylesheet" type="text/css" href="http://www.myscrm.com.cn/_frontend/controls/miniui-reset.css?ver=635633467481331512"/>
    <link rel="stylesheet" type="text/css" href="http://www.myscrm.com.cn/_frontend/themes/default/skin.css?ver=635633467514221300"/>
    <link rel="stylesheet" type="text/css" href="http://www.myscrm.com.cn/_frontend/base.css?ver=635633467379618622"/>
    <style type="text/css">
        a:visited, a:link { color: #333; }
        a:hover { text-decoration: none; }
    </style>

    <!--#include virtual="/public/inc/head_inner.html"-->

    <link rel="stylesheet" type="text/css" href="http://img-dev.myscrmimg.cn/projects/qmyx/ydxs_static/public/css/css.css"/>
    <link rel="stylesheet" type="text/css" href="http://img-dev.myscrmimg.cn/projects/qmyx/public/css/index.css"/>

    <!--#include virtual="/public/inc/seajs.html" -->
    <script>
        seajs.on('fetch', function (data) {
            var uri = data.requestUri || data.uri;
            if (uri) {
                //替换成CDN域名
                var requestUri = uri.replace(location.host, window.STATIC_HOST);

                function getPath(url, defaults) {
                    var reUrlPath = /(?:\w+:)?\/\/[^/]+([^?#]+)/;
                    var urlParts = url.match(reUrlPath) || [url, defaults];
                    return urlParts.pop();
                }

                var path = getPath(requestUri);

                var transferUri;
                if (path.indexOf('/_frontend') > -1) {
                    //移动销售站点文件
                    transferUri = 'http://' + location.host + path.substring(path.indexOf('/_frontend'));
                }

                if (transferUri) {
                    data.requestUri = transferUri;
                }
            }
        });

        (function () {
            var alias = seajs.data.alias;

            var aliasDotNet = {
                "observer": "_frontend/utility/observer",
                "ajax": "_frontend/utility/ajax",
                "map": "_frontend/utility/utility",
                "utility": "_frontend/utility/utility",
                "mapcontrol": "_frontend/utility/utility-control",
                "Control": "_frontend/controls/base-without-mini",
                "appcardlist": "_frontend/controls/appcardlist/appcardlist",
                "messagebox": "_frontend/controls/common/popup/messagebox",
                "openWin": "_frontend/controls/common/popup/openWin",
                "mini": "_frontend/3rd/miniui/sea-miniui",
                "appgrid": "_frontend/controls/appgrid/appgrid",
                "apptreegrid": "_frontend/controls/apptreegrid/apptreegrid",
                "appform": "_frontend/controls/appform/appform",
                "appgridtpl": "_frontend/templates/pages/Grid/template",
                "apptreegridtpl": "_frontend/templates/pages/TreeGrid/template",
                "appformtpl": "_frontend/templates/pages/Form/template",
                "appcardlisttpl": "_frontend/templates/pages/CardList/template",
                "pagecommon": "_frontend/utility/pagecommon",
                "myuri": "_frontend/utility/myuri",
                "seajs-debug": "_frontend/3rd/seajsdebug",
                "knockout": "_frontend/3rd/knockout",
                "komapping": "_frontend/3rd/komapping",
                "tabs": "_frontend/controls/common/tabs/tabs",
                "appfilter": "_frontend/controls/appfilter/appfilter",

                "/_frontend/3rd/simpletemplate": "_frontend/3rd/simpletemplate",
                '/_frontend/utility/dragable': '_frontend/utility/dragable',
                '/_frontend/utility/resizable': '_frontend/utility/resizable'
            };

            function mixin(map, map1) {
                for (var key in map1) {
                    if (key && map1.hasOwnProperty(key)) {
                        map[key] = map1[key];
                    }
                }
                return map;
            }

            seajs.data.alias = mixin(alias, aliasDotNet);
        })();
    </script>

    <script>
        if ($) {
            $.browser = $.browser || {};
        }
    </script>
    <script src="http://www.myscrm.com.cn/_frontend/map.js?ver=20150915164400000"></script>
    <script src="http://www.myscrm.com.cn/_frontend/3rd/miniui/miniui.js"></script>
</head>
<body>
<!--#include virtual="/public/inc/top.html" -->
<div class="container">
    <div class="wrap clearfix">
        <!--#include virtual="/static_public/public_menu/left_side/ydxs/side.html" -->
        <div class="content" id="page_iframe_wrapper" style="display: none"></div>
    </div>
</div>

<!--#include virtual="/public/inc/footer.html" -->

<script type="text/javascript">
    seajs.use(["/ydxs_static/public/js/service/index"], function () {
        $(function () {
            var $footer = $('.footer').eq(0);
            var height = $('.top').outerHeight() + $footer.outerHeight() + parseFloat($footer.css('marginTop')) - 15;

            var $side = $('.side').eq(0);
            var $contentIframe = $('.content iframe').eq(0);
            var $wnd = $(window);

            $('body').css('overflowY', 'hidden');
            $side.css({'padding-bottom': 0, 'overflow-y': 'auto'});

            function setContentHeight() {
                var contentHeight = $wnd.height() - height;
                $side.css('height', contentHeight);
                $contentIframe.css('height', contentHeight - 10);
            }

            setContentHeight();

            $(window).on('resize', function () {
                setContentHeight();
            })
        });
    });
</script>
</body>
</html>
